Skip to content

Conversation

@mortezasafaee
Copy link

@mortezasafaee mortezasafaee commented Oct 30, 2025

Sometimes database tables are very large, and not all partitions need to be reindexed. In such cases, only the last few partitions that contain data should be reindexed and have their statistics updated. In the latest update, an option has been added that allows the administrator to specify how many of the most recent partitions should be maintained.
This can be done simply by providing the following input parameters when calling IndexOptimize:
@PartitionLimitedMode = 'Y' and @PartitionDataCount INT = <number_of_partitions>.
This approach reduces reindexing time, avoids rebuilding untouched partitions, and decreases the workload on the server — especially for large, high-volume operational databases.

For large partitioned tables, older partitions are often read-only and do not require frequent index maintenance or stats updates.

Most data modifications occur in the latest partitions; rebuilding only the last N partitions reduces maintenance time, I/O, and locking/blocking.

This approach is particularly useful for OLTP and reporting systems where recent data is accessed more frequently than historical data.

Helps maintain index performance and statistics without impacting server resources unnecessarily.

Sure — here's the full translated version including your new part:

---

Sometimes database tables are very large, and not all partitions need to be reindexed. In such cases, only the last few partitions that contain data should be reindexed and have their statistics updated. In the latest update, an option has been added that allows the administrator to specify how many of the most recent partitions should be maintained.
This can be done simply by providing the following input parameters when calling **IndexOptimize**:
`@PartitionLimitedMode  = 'Y'` and `@PartitionDataCount INT = <number_of_partitions>`.
@mortezasafaee mortezasafaee changed the title Update IndexOptimize.sql Added Feature ParitionLimitedMode IndexOptimize.sql Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant